package com.yuncheng.spcyApi.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuncheng.spcyApi.alog.annotation.Log;
import com.yuncheng.spcyApi.bo.*;
import com.yuncheng.spcyApi.dto.WlStatListDto;
import com.yuncheng.spcyApi.spcyService.SpcyQyInfoService;
import com.yuncheng.spcyApi.constant.common.SpcyCommonConstant;
import com.yuncheng.spcyApi.dto.QyJyxxDto;
import com.yuncheng.spcyApi.entity.*;
import com.yuncheng.exception.BusinessException;
import com.yuncheng.spcyApi.mapper.SpcyQyWfwjjlMapper;
import com.yuncheng.spcyApi.utils.StringPatternUtils;
import com.yuncheng.spcyApi.vo.common.HttpResultVo;
import com.yuncheng.spcyApi.vo.common.PageVo;
import com.yuncheng.spcyApi.vo.common.Result;
import com.yuncheng.spcyApi.vo.common.StartEndDateVo;
import com.yuncheng.spcyApi.vo.qy.QyWfjlVo;
import com.yuncheng.vo.HttpResult;
import io.swagger.annotations.*;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description: 审评查验-企业相关信息
 * @Author: csx
 * @Date: 2023-03-03
 * @Version: V1.0
 */
@Api(tags = "审评查验-企业相关信息")
@RestController
@RequestMapping("/api/spzx-spcy/spcyQyInfo")
public class SpcyQyInfoController {

    private static final Logger log = LoggerFactory.getLogger(SpcyQyInfoController.class);

    @Resource
    private SpcyQyInfoService spcyQyInfoService;

    @Resource
    private SpcyQyWfwjjlMapper spcyQyWfwjjlMapper;

    /************************************[ 企业-企业基本信息 ]**************************************************************************/

    @Log(title = "获取当前登录的企业详情")
    @ApiOperation(value = "获取当前登录的企业详情")
    @GetMapping(value = "queryQyJbxxById")
    public HttpResult<?> queryQyJbxxById(@RequestParam(value = "fqyid",defaultValue = "")String fqyid,
                                         @RequestParam(value = "onlyCurrentUser", defaultValue = "true") boolean onlyCurrentUser){
        Map resultMap = spcyQyInfoService.queryQyJbxxById(fqyid, onlyCurrentUser);
        return HttpResult.ok(resultMap);
    }

    @Log(title = "企业基本信息-更新")
    @ApiOperation(value = "企业基本信息-更新")
    @PutMapping(value = "/editQyxx")
    public HttpResult<?> editQyxx(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.editQyxx(buffer);
    }

    @Log(title = "同步-行政审批-企业数据")
    @ApiOperation(value = "同步-行政审批-企业数据")
    @GetMapping(value = "syncXzxkXdrxx")
    public HttpResult<?> syncXzxkXdrxx(@RequestParam(value = "tyshxydm")String tyshxydm){
        if (StringUtils.isBlank(tyshxydm)){
            return HttpResult.error("统一社会信用代码不能为空");
        }

        Result result = spcyQyInfoService.syncXzxkXdrxx(tyshxydm);
        if (!result.isSuccess()){
            return HttpResult.error(result.getMessage());
        }

        return HttpResult.ok("同步成功");
    }

    @Log(title = "同步-行政审批-企业数据")
    @ApiOperation(value = "同步-行政审批-企业数据")
    @GetMapping(value = "syncXzxkXdrxx2")
    public HttpResult<?> syncXzxkXdrxx2(@RequestParam(value = "tyshxydm",defaultValue = "")String tyshxydm){

        Result result = spcyQyInfoService.syncUpdateXzxkXdrxx(tyshxydm);
        if (!result.isSuccess()){
            return HttpResult.error(result.getMessage());
        }

        return HttpResult.ok("同步成功");
    }

    @Log(title = "给企业设置账号")
    @ApiOperation(value = "给企业设置账号")
    @GetMapping(value = "addUserQyAccount")
    public HttpResult<?> addUserQyAccount(@RequestParam(value = "fqyid",defaultValue = "")String fqyid){

        Result result = spcyQyInfoService.addUserQy(fqyid, null);
        if (!result.isSuccess()){
            return HttpResult.error(result.getMessage());
        }
        return HttpResult.ok("设置成功");
    }

    /************************************[ 企业-品种基本信息 ]**************************************************************************/

    @Log(title = "品种基本信息-分页查询")
    @ApiOperation(value = "品种基本信息-分页查询")
    @GetMapping(value = "queryPzjbxxPageList")
    public HttpResult<?> queryPzjbxxPageList(SpcyQyPzjbxx spcyQyPzjbxx,
                                             @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                             @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {
        if (StringUtils.isBlank(spcyQyPzjbxx.getFqyid())){
            return HttpResult.error("企业参数为空");
        }
        return spcyQyInfoService.queryPzjbxxPageList(spcyQyPzjbxx,pageNo,pageSize);
    }

    @Log(title = "品种基本信息-添加")
    @ApiOperation(value = "品种基本信息-添加")
    @PostMapping(value = "addPzjbxx")
    public HttpResult addPzjbxx(@RequestBody SpcyQyPzjbxx pzjbxx,
                                @RequestParam(value = "onlyCurrentUser", defaultValue = "false") boolean onlyCurrentUser) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(pzjbxx.getId())){
            return spcyQyInfoService.updatePzjbxx((HashMap<String, String>) BeanUtils.describe(pzjbxx));
        }
        return spcyQyInfoService.addPzjbxx(pzjbxx,onlyCurrentUser);
    }

    @Log(title = "品种基本信息-更新")
    @ApiOperation(value = "品种基本信息-更新")
    @PutMapping(value = "updatePzjbxx")
    public HttpResult updatePzjbxx(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updatePzjbxx(buffer);
    }

    @Log(title = "品种基本信息-删除")
    @ApiOperation(value = "品种基本信息-删除")
    @DeleteMapping(value = "deletePzjbxx")
    public HttpResult deletePzjbxx(String ids){
        return spcyQyInfoService.deletePzjbxx(ids);
    }

    @Log(title = "品种基本信息-通过id查询")
    @ApiOperation(value = "品种基本信息-通过id查询")
    @DeleteMapping(value = "queryPzjbxxById")
    public HttpResult<?> queryPzjbxxById(String id) {
        return spcyQyInfoService.queryPzjbxxById(id);
    }


    /************************************[ 企业-企业关键人员信息 ]**************************************************************************/
    @Log(title = "企业关键人员信息-分页查询")
    @ApiOperation(value = "关键人员信息-分页查询")
    @GetMapping(value = "queryQygjryxxPageList")
    public HttpResult<?> queryQygjryxxPageList(SpcyQyQygjryxx spcyQyQygjryxx, @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                             @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {
        if (StringUtils.isBlank(spcyQyQygjryxx.getFqyid())){
            return HttpResult.error("企业参数id不能为空");
        }
        return spcyQyInfoService.queryQygjryxxPageList(spcyQyQygjryxx,pageNo,pageSize);
    }

    @Log(title = "查询企业人员-关键人员姓名")
    @ApiOperation(value = "查询企业人员-关键人员姓名")
    @GetMapping(value = "queryQyGjryxm")
    public HttpResult<?> queryQyGjryxm(@RequestParam(value = "fqyid",defaultValue = "") String fqyid) {
        if (StringUtils.isBlank(fqyid)){
            return HttpResult.error("企业参数不能为空");
        }

        return HttpResultVo.HttpResultGet(spcyQyInfoService.selectQyGjryXx(fqyid));
    }

    @Log(title = "企业关键人员信息-添加")
    @ApiOperation(value = "企业关键人员信息-添加")
    @PostMapping(value = "Qygjryxx")
    public HttpResult addQygjryxx(@RequestBody SpcyQyQygjryxx gjryxx,
                                @RequestParam(value = "onlyCurrentUser", defaultValue = "false") boolean onlyCurrentUser) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(gjryxx.getId())){
            return spcyQyInfoService.updateQygjryxx((HashMap<String, String>) BeanUtils.describe(gjryxx));
        }
        return spcyQyInfoService.addQygjryxx(gjryxx,onlyCurrentUser);
    }

    @Log(title = "企业关键人员信息-更新")
    @ApiOperation(value = "企业关键人员信息-更新")
    @PutMapping(value = "updateQygjryxx")
    public HttpResult updateQygjryxx(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateQygjryxx(buffer);
    }

    @Log(title = "企业关键人员信息-删除")
    @ApiOperation(value = "企业关键人员信息-删除")
    @DeleteMapping(value = "deleteQygjryxx")
    public HttpResult deleteQygjryxx(String ids){
        return spcyQyInfoService.deleteQygjryxx(ids);
    }

    @Log(title = "企业关键人员信息-通过id查询")
    @ApiOperation(value = "企业关键人员信息-通过id查询")
    @DeleteMapping(value = "queryQygjryxxById")
    public HttpResult<?> queryQygjryxxById(String id) {
        return spcyQyInfoService.queryQygjryxx(id);
    }

    /************************************[ 企业-人员岗位变更记录 ]**************************************************************************/

    @Log(title = "岗位变更记录-分页查询")
    @ApiOperation(value = "岗位变更记录-分页查询")
    @GetMapping(value = "queryQyRyBgjlPageList")
    public HttpResult<?> queryQyRyBgjlPageList(SpcyQyRygwbgjl query,
                                               @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                               @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {
        if (StringUtils.isBlank(query.getFqyid())){
            return HttpResult.error("企业参数id不能为空");
        }
        return spcyQyInfoService.queryQyRyBgjlPageList(query,pageNo,pageSize);
    }

    @Log(title = "添加人员岗位变更记录")
    @ApiOperation(value = "添加人员岗位变更记录")
    @GetMapping(value = "addRygwbgjl")
    public HttpResult addRygwbgjl(@RequestParam(value = "id",defaultValue = "")String id,
                                  @RequestParam(value = "fbghgw",defaultValue = "")String fbghgw) throws InvocationTargetException, IllegalAccessException {

        spcyQyInfoService.addRygwbgjl(id, fbghgw);
        return HttpResult.ok("变更成功");
    }

    /************************************[ 企业-原料供应商审计 ]**************************************************************************/

    @Log(title = "供应商信息-分页查询")
    @ApiOperation(value = "供应商信息-分页查询")
    @GetMapping(value = "getGysxxPageList")
    public HttpResult<?> getGysxxPageList(SpcyQyYlgyssj query,
                                          @RequestParam(value = "gjz",defaultValue = "") String gjz,
                                          PageVo pageVo) {
        if (StringUtils.isBlank(query.getFqyid())){
            return HttpResult.error("企业参数为空");
        }

        return spcyQyInfoService.selectGysxxPageList(query, gjz, pageVo);
    }

    @Log(title = "原料供应商审计-分页查询")
    @ApiOperation(value = "原料供应商审计-分页查询")
    @ApiImplicitParam(name = "sfgq",value = "是否过期（未过期/即将过期/已过期/长期有效")
    @GetMapping(value = "queryYlgyssjPageList")
    public HttpResult<?> queryYlgyssjPageList(QyYlgyssjYjxxParamBo wl,
                                              @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                              @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {
        if (StringUtils.isBlank(wl.getFqyid())){
            return HttpResult.error("企业参数id不能为空");
        }
        return spcyQyInfoService.queryYlgyssjPageList(wl, pageNo,pageSize);
    }

    @Log(title = "供应商信息-添加")
    @ApiOperation(value = "供应商信息-添加")
    @PostMapping(value = "addYlgyssj")
    public HttpResult addYlgyssj(@RequestBody SpcyQyYlgyssj ylgyssj,
                                  @RequestParam(value = "onlyCurrentUser", defaultValue = "false") boolean onlyCurrentUser) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(ylgyssj.getId())){
            return spcyQyInfoService.updateYlgyssj((HashMap<String, String>) BeanUtils.describe(ylgyssj));
        }
        return spcyQyInfoService.addYlgyssj(ylgyssj,onlyCurrentUser);
    }

    @Log(title = "供应商信息-更新")
    @ApiOperation(value = "供应商信息-更新")
    @PutMapping(value = "updateYlgyssj")
    public HttpResult updateYlgyssj(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateYlgyssj(buffer);
    }

    @Log(title = "供应商信息-删除")
    @ApiOperation(value = "供应商信息-删除")
    @DeleteMapping(value = "deleteYlgyssj")
    public HttpResult deleteYlgyssj(String ids){
        return spcyQyInfoService.deleteYlgyssj(ids);
    }

    @Log(title = "供应商信息-通过id查询")
    @ApiOperation(value = "供应商信息-通过id查询")
    @GetMapping(value = "queryYlgyssjById")
    public HttpResult<?> queryYlgyssjById(String id) {
        return spcyQyInfoService.queryYlgyssjById(id);
    }

    /************************************[ 企业-设备确认信息 ]**************************************************************************/

    @Log(title = "设备确认信息-分页查询")
    @ApiOperation(value = "设备确认信息-分页查询")
    @GetMapping(value = "querySbqrxxPageList")
    public HttpResult<?> querySbqrxxPageList(SpcyQySbqrxx spcyQySbqrxx, @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                              @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {
        if (StringUtils.isBlank(spcyQySbqrxx.getFqyid())){
            return HttpResult.error("企业参数id不能为空");
        }
        return spcyQyInfoService.querySbqrxxPageList(spcyQySbqrxx,pageNo,pageSize);
    }

    @Log(title = "设备确认信息-添加")
    @ApiOperation(value = "设备确认信息-添加")
    @PostMapping(value = "addSbqrxx")
    public HttpResult addSbqrxx(@RequestBody SpcyQySbqrxx sbqrxx,
                                 @RequestParam(value = "onlyCurrentUser", defaultValue = "false") boolean onlyCurrentUser) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(sbqrxx.getId())){
            return spcyQyInfoService.updateSbqrxx((HashMap<String, String>) BeanUtils.describe(sbqrxx));
        }
        return spcyQyInfoService.addSbqrxx(sbqrxx,onlyCurrentUser);
    }

    @Log(title = "设备确认信息-更新")
    @ApiOperation(value = "设备确认信息-更新")
    @PutMapping(value = "updateSbqrxx")
    public HttpResult updateSbqrxx(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateSbqrxx(buffer);
    }

    @Log(title = "设备确认信息-删除")
    @ApiOperation(value = "设备确认信息-删除")
    @DeleteMapping(value = "deleteSbqrxx")
    public HttpResult deleteSbqrxx(String ids){
        return spcyQyInfoService.deleteSbqrxx(ids);
    }

    @Log(title = "设备确认信息-通过id查询")
    @ApiOperation(value = "设备确认信息-通过id查询")
    @DeleteMapping(value = "querySbqrxxById")
    public HttpResult<?> querySbqrxxById(String id) {
        return spcyQyInfoService.querySbqrxxById(id);
    }

    /************************************[ 企业-产品偏差信息 ]**************************************************************************/

    @Log(title = "产品偏差信息-分页查询")
    @ApiOperation(value = "产品偏差信息-分页查询")
    @GetMapping(value = "queryCppcxxPageList")
    public HttpResult<?> queryCppcxxPageList(SpcyQyCppcxx spcyQyCppcxx,
                                             StartEndDateVo startEndDateVo,
                                             @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                             @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {
        if (StringUtils.isBlank(spcyQyCppcxx.getFqyid())){
            return HttpResult.error("企业参数id不能为空");
        }
        return spcyQyInfoService.queryCppcxxPageList(spcyQyCppcxx,startEndDateVo,pageNo,pageSize);
    }

    @Log(title = "产品偏差信息-添加")
    @ApiOperation(value = "产品偏差信息-添加")
    @PostMapping(value = "addCppcxx")
    public HttpResult addCppcxx(@RequestBody SpcyQyCppcxx cppcxx,
                                @RequestParam(value = "onlyCurrentUser", defaultValue = "false") boolean onlyCurrentUser) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(cppcxx.getId())){
            return spcyQyInfoService.updateCppcxx((HashMap<String, String>) BeanUtils.describe(cppcxx));
        }
        return spcyQyInfoService.addCppcxx(cppcxx,onlyCurrentUser);
    }

    @Log(title = "产品偏差信息-更新")
    @ApiOperation(value = "产品偏差信息-更新")
    @PutMapping(value = "updateCppcxx")
    public HttpResult updateCppcxx(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateCppcxx(buffer);
    }

    @Log(title = "产品偏差信息-删除")
    @ApiOperation(value = "产品偏差信息-删除")
    @DeleteMapping(value = "deleteCppcxx")
    public HttpResult deleteCppcxx(String ids){
        return spcyQyInfoService.deleteCppcxx(ids);
    }

    @Log(title = "产品偏差信息-通过id查询")
    @ApiOperation(value = "产品偏差信息-通过id查询")
    @DeleteMapping(value = "queryCppcxxById")
    public HttpResult<?> queryCppcxxById(String id) {
        return spcyQyInfoService.queryCppcxxById(id);
    }


    /************************************[ 企业-变更控制信息 ]**************************************************************************/

    @Log(title = "变更控制信息-分页查询")
    @ApiOperation(value = "变更控制信息-分页查询")
    @GetMapping(value = "queryBgkzPageList")
    public HttpResult<?> queryBgkzPageList(SpcyQyBgkz bgkz,
                                           StartEndDateVo startEndDateVo,
                                           @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                           @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {
        if (StringUtils.isBlank(bgkz.getFqyid())){
            return HttpResult.error("企业参数id不能为空");
        }
        return spcyQyInfoService.queryBgkzPageList(bgkz,startEndDateVo,pageNo,pageSize);
    }

    @Log(title = "变更控制信息-添加")
    @ApiOperation(value = "变更控制信息-添加")
    @PostMapping(value = "addBgkz")
    public HttpResult addBgkz(@RequestBody SpcyQyBgkz bgkz,
                                @RequestParam(value = "onlyCurrentUser", defaultValue = "false") boolean onlyCurrentUser) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(bgkz.getId())){
            return spcyQyInfoService.updateBgkz((HashMap<String, String>) BeanUtils.describe(bgkz));
        }
        return spcyQyInfoService.addBgkz(bgkz,onlyCurrentUser);
    }

    @Log(title = "变更控制信息-更新")
    @ApiOperation(value = "变更控制信息-更新")
    @PutMapping(value = "updateBgkz")
    public HttpResult updateBgkz(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateBgkz(buffer);
    }

    @Log(title = "变更控制信息-删除")
    @ApiOperation(value = "变更控制信息-删除")
    @DeleteMapping(value = "deleteBgkz")
    public HttpResult deleteBgkz(String ids){
        return spcyQyInfoService.deleteBgkz(ids);
    }

    @Log(title = "变更控制信息-通过id查询")
    @ApiOperation(value = "变更控制信息-通过id查询")
    @DeleteMapping(value = "queryBgkzById")
    public HttpResult<?> queryBgkzById(String id) {
        return spcyQyInfoService.queryBgkzById(id);
    }

    /************************************[ 企业-清洁验证 ]**************************************************************************/

    @Log(title = "清洁验证-分页查询")
    @ApiOperation(value = "清洁验证-分页查询")
    @GetMapping(value = "queryQjyzPageList")
    public HttpResult<?> queryQjyzPageList(SpcyQyQjyz qyQjyz, @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                             @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {
        if (StringUtils.isBlank(qyQjyz.getFqyid())){
            return HttpResult.error("企业参数id不能为空");
        }
        return spcyQyInfoService.queryQjyzPageList(qyQjyz,pageNo,pageSize);
    }

    @Log(title = "清洁验证-添加")
    @ApiOperation(value = "清洁验证-添加")
    @PostMapping(value = "addQjyz")
    public HttpResult addQjyz(@RequestBody SpcyQyQjyz qyQjyz,
                                @RequestParam(value = "onlyCurrentUser", defaultValue = "false") boolean onlyCurrentUser) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(qyQjyz.getId())){
            return spcyQyInfoService.updateQjyz((HashMap<String, String>) BeanUtils.describe(qyQjyz));
        }
        return spcyQyInfoService.addQjyz(qyQjyz,onlyCurrentUser);
    }

    @Log(title = "清洁验证-更新")
    @ApiOperation(value = "清洁验证-更新")
    @PutMapping(value = "updateQjyz")
    public HttpResult updateQjyz(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateQjyz(buffer);
    }

    @Log(title = "清洁验证-删除")
    @ApiOperation(value = "清洁验证-删除")
    @DeleteMapping(value = "deleteQjyz")
    public HttpResult deleteQjyz(String ids){
        return spcyQyInfoService.deleteQjyz(ids);
    }

    @Log(title = "清洁验证-通过id查询")
    @ApiOperation(value = "清洁验证-通过id查询")
    @DeleteMapping(value = "queryQjyzById")
    public HttpResult<?> queryQjyzById(String id) {
        return spcyQyInfoService.queryQjyzById(id);
    }

    /************************************[ 企业-工艺验证 ]**************************************************************************/

    @Log(title = "工艺验证-分页查询")
    @ApiOperation(value = "工艺验证-分页查询")
    @GetMapping(value = "queryQyGyyzPageList")
    public HttpResult<?> queryQyGyyzPageList(SpcyQyGyyz gyyz, @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                           @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {
        if (StringUtils.isBlank(gyyz.getFqyid())){
            return HttpResult.error("企业参数id不能为空");
        }
        return spcyQyInfoService.queryQyGyyzPageList(gyyz,pageNo,pageSize);
    }

    @Log(title = "工艺验证-添加")
    @ApiOperation(value = "工艺验证-添加")
    @PostMapping(value = "addGyyz")
    public HttpResult addGyyz(@RequestBody SpcyQyGyyz gyyz,
                              @RequestParam(value = "onlyCurrentUser", defaultValue = "false") boolean onlyCurrentUser) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(gyyz.getId())){
            return spcyQyInfoService.updateGyyz((HashMap<String, String>) BeanUtils.describe(gyyz));
        }
        return spcyQyInfoService.addGyyz(gyyz,onlyCurrentUser);
    }

    @Log(title = "工艺验证-更新")
    @ApiOperation(value = "工艺验证-更新")
    @PutMapping(value = "updateGyyz")
    public HttpResult updateGyyz(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateGyyz(buffer);
    }

    @Log(title = "工艺验证-删除")
    @ApiOperation(value = "工艺验证-删除")
    @DeleteMapping(value = "deleteGyyz")
    public HttpResult deleteGyyz(String ids){
        return spcyQyInfoService.deleteGyyz(ids);
    }

    @Log(title = "工艺验证-通过id查询")
    @ApiOperation(value = "工艺验证-通过id查询")
    @DeleteMapping(value = "queryGyyzById")
    public HttpResult<?> queryGyyzById(String id) {
        return spcyQyInfoService.queryGyyzById(id);
    }

    /************************************[ 企业-检查信息 ]**************************************************************************/

    @Log(title = "检查信息-分页查询")
    @ApiOperation(value = "检查信息-分页查询")
    @GetMapping(value = "queryQyJcxxPageList")
    public HttpResult<?> queryQyJcxxPageList(SpcyQyJcxx jcxx, @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                             @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {
        if (StringUtils.isBlank(jcxx.getFqyid())){
            return HttpResult.error("企业参数id不能为空");
        }
        return spcyQyInfoService.queryQyJcxxPageList(jcxx,pageNo,pageSize);
    }

    @Log(title = "检查信息-添加")
    @ApiOperation(value = "检查信息-添加")
    @PostMapping(value = "addQyJcxx")
    public HttpResult addQyJcxx(@RequestBody SpcyQyJcxx jcxx,
                              @RequestParam(value = "onlyCurrentUser", defaultValue = "false") boolean onlyCurrentUser) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(jcxx.getId())){
            return spcyQyInfoService.updateJcxx((HashMap<String, String>) BeanUtils.describe(jcxx));
        }
        return spcyQyInfoService.addQyJcxx(jcxx,onlyCurrentUser);
    }

    @Log(title = "检查信息-更新")
    @ApiOperation(value = "检查信息-更新")
    @PutMapping(value = "updateJcxx")
    public HttpResult updateJcxx(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateJcxx(buffer);
    }

    @Log(title = "检查信息-删除")
    @ApiOperation(value = "检查信息-删除")
    @DeleteMapping(value = "deleteJcxx")
    public HttpResult deleteJcxx(String ids){
        return spcyQyInfoService.deleteJcxx(ids);
    }

    @Log(title = "检查信息-通过id查询")
    @ApiOperation(value = "检查信息-通过id查询")
    @DeleteMapping(value = "queryJcxxById")
    public HttpResult<?> queryJcxxById(String id) {
        return spcyQyInfoService.queryGyyzById(id);
    }

    /************************************[ 企业-证件信息 ]**************************************************************************/

    @Log(title = "证件信息-分页查询")
    @ApiOperation(value = "证件信息-分页查询")
    @GetMapping(value = "queryQyZjxxPageList")
    public HttpResult<?> queryQyZjxxPageList(QyZjyjxxParamBo zjxx, @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                             @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {
        if (StringUtils.isBlank(zjxx.getFqyid())){
            return HttpResult.error("企业参数id不能为空");
        }
        return spcyQyInfoService.queryQyZjxxPageList(zjxx,pageNo,pageSize);
    }

    @Log(title = "证件信息-添加")
    @ApiOperation(value = "证件信息-添加")
    @PostMapping(value = "addZjxx")
    public HttpResult addZjxx(@RequestBody SpcyQyZjxx zjxx,
                                @RequestParam(value = "onlyCurrentUser", defaultValue = "false") boolean onlyCurrentUser) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(zjxx.getId())){
            return spcyQyInfoService.updateZjxx((HashMap<String, String>) BeanUtils.describe(zjxx));
        }
        return spcyQyInfoService.addZjxx(zjxx,onlyCurrentUser);
    }

    @Log(title = "证件信息-更新")
    @ApiOperation(value = "证件信息-更新")
    @PutMapping(value = "updateZjxx")
    public HttpResult updateZjxx(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateZjxx(buffer);
    }

    @Log(title = "证件信息-删除")
    @ApiOperation(value = "证件信息-删除")
    @DeleteMapping(value = "deleteZjxx")
    public HttpResult deleteZjxx(String ids){
        return spcyQyInfoService.deleteZjxx(ids);
    }

    @Log(title = "证件文件上传")
    @ApiOperation(value = "证件文件上传")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "file",value = "需要上传的文件，文件不能为空",required = true),
            @ApiImplicitParam(name = "id",value = "证件id",required = true)
    })
    @PostMapping(value = "/uploadQyZjFile")
    public HttpResult<?> uploadQyZjFile(@RequestPart("file") MultipartFile[] file,
                                        @RequestParam(value = "id",defaultValue = "") String id){
        SpcyQyWjjl spcyQyWjjl = new SpcyQyWjjl();
        spcyQyWjjl.setFwjlx1(SpcyCommonConstant.QY_ZJXX_WJLX_QYZJ);
        return spcyQyInfoService.uploadMoreTypeFile(file,id,spcyQyWjjl);
    }

    @Log(title = "获取证件信息相关附件")
    @ApiOperation(value = "获取证件信息相关附件")
    @GetMapping(value = "/queryQyZjFileList")
    public HttpResult<?> queryQyZjFileList(@RequestParam(value = "id",defaultValue = "") String id){
        return HttpResult.ok(spcyQyInfoService.queryQyFileList(id));
    }

    /************************************[ 企业-预警信息 ]**************************************************************************/

    @Log(title = "证件预警信息-查询")
    @ApiOperation(value = "证件预警信息-查询")
    @GetMapping(value = "queryZjyjPageList")
    public HttpResult queryZjyjPageList(@RequestParam(value = "fqyid",defaultValue = "")String fqyid,@RequestParam(value = "onlyCurrentUser", defaultValue = "")String onlyCurrentUser){
        return spcyQyInfoService.queryZjyjPageList(fqyid, onlyCurrentUser);
    }

    @Log(title = "物料审计预警信息-查询")
    @ApiOperation(value = "物料审计预警信息-查询")
    @GetMapping(value = "queryWlsjyjPageList")
    public HttpResult queryWlsjyjPageList(@RequestParam(value = "fqyid",defaultValue = "")String fqyid,@RequestParam(value = "onlyCurrentUser", defaultValue = "")String onlyCurrentUser){
        return spcyQyInfoService.queryWlsjyjPageList(fqyid, onlyCurrentUser);
    }

    @Log(title = "物料平衡预警信息-查询")
    @ApiOperation(value = "物料平衡预警信息-查询")
    @GetMapping(value = "queryWlphyjPageList")
    public HttpResult queryWlphyjPageList(@RequestParam(value = "fqyid",defaultValue = "")String fqyid,@RequestParam(value = "onlyCurrentUser", defaultValue = "")String onlyCurrentUser){
        return spcyQyInfoService.queryWlphyjPageList(fqyid, onlyCurrentUser);
    }

    @Log(title = "生产环境预警信息-查询")
    @ApiOperation(value = "生产环境预警信息-查询")
    @GetMapping(value = "querySchjYjPageList")
    public HttpResult querySchjYjPageList(@RequestParam(value = "fqyid",defaultValue = "")String fqyid,@RequestParam(value = "onlyCurrentUser", defaultValue = "")String onlyCurrentUser){
        return spcyQyInfoService.querySchjYjPageList(fqyid, onlyCurrentUser);
    }

    @Log(title = "关键指标预警信息-查询")
    @ApiOperation(value = "关键指标预警信息-查询")
    @GetMapping(value = "queryGjzbYjPageList")
    public HttpResult queryGjzbYjPageList(@RequestParam(value = "fqyid",defaultValue = "")String fqyid,@RequestParam(value = "onlyCurrentUser", defaultValue = "")String onlyCurrentUser){
        return spcyQyInfoService.queryGjzbYjPageList(fqyid, onlyCurrentUser);
    }

    @Log(title = "车间预警-查询")
    @ApiOperation(value = "车间预警-查询")
    @GetMapping(value = "queryCjYjxx")
    public HttpResult queryCjYjxx(@RequestParam(value = "id",defaultValue = "")String id,
                                  @RequestParam(value = "dayDate",defaultValue = "")String dayDate){
        return spcyQyInfoService.queryCjYjxx(id, dayDate);
    }

    @Log(title = "根据检验项目-获取所有关键指标")
    @ApiOperation(value = "根据检验项目-获取所有关键指标")
    @GetMapping(value = "queryGjzbListByJyxx")
    public HttpResult queryGjzbListByJyxx(@RequestParam(value = "fjyid",defaultValue = "")String fjyid){
        return spcyQyInfoService.queryGjzbListByJyxx(fjyid);
    }

    @Log(title = "根据关键指标-查询关键指标预警信息")
    @ApiOperation(value = "根据关键指标-查询关键指标预警信息")
    @GetMapping(value = "queryGjzbYjByJyxx")
    public HttpResult queryGjzbYjByJyxx(@RequestParam(value = "fjyid",defaultValue = "")String fjyid,
                                        @RequestParam(value = "fxmmc",defaultValue = "")String fxmmc){
        return spcyQyInfoService.queryGjzbYjByJyxx(fjyid, fxmmc);
    }



    /************************************[ 企业-生产车间 ]**************************************************************************/

    @Log(title = "生产车间-分页查询")
    @ApiOperation(value = "生产车间-分页查询")
    @GetMapping(value = "querySccjPageList")
    public HttpResult<?> querySccjPageList(SpcyQySccj query,
                                           @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                           @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {
        if (StringUtils.isBlank(query.getFqyid())){
            return HttpResult.error("企业参数id不能为空");
        }
        return spcyQyInfoService.querySccjPageList(query,pageNo,pageSize);
    }

    @Log(title = "生产车间-分页查询-根据品种")
    @ApiOperation(value = "生产车间-分页查询-根据品种")
    @GetMapping(value = "querySccjByPz")
    public HttpResult<?> querySccjByPz(SpcyQySccj query, PageVo pageVo) {
        if (StringUtils.isBlank(query.getFpzid())){
            return HttpResult.error("品种参数为空！");
        }
        return spcyQyInfoService.querySccjPageList(query, pageVo.getPageNo(), pageVo.getPageSize());
    }

    @Log(title = "生产车间-添加")
    @ApiOperation(value = "生产车间-添加")
    @PostMapping(value = "addSccj")
    public HttpResult addSccj(@RequestBody SpcyQySccj bean,
                              @RequestParam(value = "onlyCurrentUser", defaultValue = "false") boolean onlyCurrentUser) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(bean.getId())){
            return spcyQyInfoService.updateSccj((HashMap<String, String>) BeanUtils.describe(bean));
        }
        return spcyQyInfoService.addSccj(bean,onlyCurrentUser);
    }

    @Log(title = "生产车间-添加-根据品种")
    @ApiOperation(value = "生产车间-添加-根据品种")
    @PostMapping(value = "addSccjByPz")
    public HttpResult addSccjByPz(@RequestBody SpcyQySccj bean) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(bean.getId())){
            return spcyQyInfoService.updateSccj((HashMap<String, String>) BeanUtils.describe(bean));
        }

        if (StringUtils.isBlank(bean.getFpzid())){
            return HttpResult.error("品种参数为空！");
        }
        return spcyQyInfoService.addSccj(bean, false);
    }

    @Log(title = "生产车间-更新")
    @ApiOperation(value = "生产车间-更新")
    @PutMapping(value = "updateSccj")
    public HttpResult updateSccj(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateSccj(buffer);
    }

    @Log(title = "生产车间-删除")
    @ApiOperation(value = "生产车间-删除")
    @DeleteMapping(value = "deleteSccj")
    public HttpResult deleteSccj(@RequestParam(value = "ids",defaultValue = "")String ids){
        return spcyQyInfoService.deleteSccj(ids);
    }

    /************************************[ 企业-生产工艺 ]**************************************************************************/


    @Log(title = "生产工艺-分页查询-根据品种")
    @ApiOperation(value = "生产工艺-分页查询-根据品种")
    @GetMapping(value = "queryScgyByPz")
    public HttpResult<?> queryScgyByPz(SpcyQyScgy query, PageVo pageVo) {
        if (StringUtils.isBlank(query.getFpzid())){
            return HttpResult.error("品种参数为空！");
        }
        return spcyQyInfoService.queryScgyPageList(query, pageVo.getPageNo(), pageVo.getPageSize());
    }

    @Log(title = "生产工艺-添加-根据品种")
    @ApiOperation(value = "生产工艺-添加-根据品种")
    @PostMapping(value = "addScgyByPz")
    public HttpResult addScgyByPz(@RequestBody SpcyQyScgy bean) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(bean.getId())){
            return spcyQyInfoService.updateScgy((HashMap<String, String>) BeanUtils.describe(bean));
        }

        return spcyQyInfoService.addScgy(bean, false);
    }

    @Log(title = "生产工艺-更新")
    @ApiOperation(value = "生产工艺-更新")
    @PutMapping(value = "updateScgy")
    public HttpResult updateScgy(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateScgy(buffer);
    }

    @Log(title = "生产工艺-删除")
    @ApiOperation(value = "生产工艺-删除")
    @DeleteMapping(value = "deleteScgy")
    public HttpResult deleteScgy(@RequestParam(value = "ids",defaultValue = "")String ids){
        return spcyQyInfoService.deleteScgy(ids);
    }

    /************************************[ 企业-药品生产状况 ]**************************************************************************/

    @Log(title = "药品生产状况-分页查询-根据品种")
    @ApiOperation(value = "药品生产状况-分页查询-根据品种")
    @GetMapping(value = "queryYpsczkByPz")
    public HttpResult<?> queryYpsczkByPz(SpcyQyYpsczk query, PageVo pageVo) {
        if (StringUtils.isBlank(query.getFpzid())){
            return HttpResult.error("品种参数为空！");
        }
        return spcyQyInfoService.queryYpsczkPageList(query, pageVo.getPageNo(), pageVo.getPageSize());
    }

    @Log(title = "药品生产状况-添加-根据品种")
    @ApiOperation(value = "药品生产状况-添加-根据品种")
    @PostMapping(value = "addYpsczkByPz")
    public HttpResult addYpsczkByPz(@RequestBody SpcyQyYpsczk bean) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(bean.getId())){
            return spcyQyInfoService.updateYpsczk((HashMap<String, String>) BeanUtils.describe(bean));
        }

        return spcyQyInfoService.addYpsczk(bean, false);
    }

    @Log(title = "药品生产状况-更新")
    @ApiOperation(value = "药品生产状况-更新")
    @PutMapping(value = "updateYpsczk")
    public HttpResult updateYpsczk(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateYpsczk(buffer);
    }

    @Log(title = "药品生产状况-删除")
    @ApiOperation(value = "药品生产状况-删除")
    @DeleteMapping(value = "deleteYpsczk")
    public HttpResult deleteYpsczk(@RequestParam(value = "ids",defaultValue = "")String ids){
        return spcyQyInfoService.deleteYpsczk(ids);
    }

    /************************************[ 企业-药品委托生产 ]**************************************************************************/

    @Log(title = "药品委托生产-分页查询-根据品种")
    @ApiOperation(value = "药品委托生产-分页查询-根据品种")
    @GetMapping(value = "queryYpwtscByPz")
    public HttpResult<?> queryYpwtscByPz(SpcyQyYpwtsc query, PageVo pageVo) {
        if (StringUtils.isBlank(query.getFpzid())){
            return HttpResult.error("品种参数为空！");
        }
        return spcyQyInfoService.queryYpwtscPageList(query, pageVo.getPageNo(), pageVo.getPageSize());
    }

    @Log(title = "药品委托生产-添加-根据品种")
    @ApiOperation(value = "药品委托生产-添加-根据品种")
    @PostMapping(value = "addYpwtscByPz")
    public HttpResult addYpwtscByPz(@RequestBody SpcyQyYpwtsc bean) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(bean.getId())){
            return spcyQyInfoService.updateYpwtsc((HashMap<String, String>) BeanUtils.describe(bean));
        }

        return spcyQyInfoService.addYpwtsc(bean, false);
    }

    @Log(title = "药品委托生产-更新")
    @ApiOperation(value = "药品委托生产-更新")
    @PutMapping(value = "updateYpwtsc")
    public HttpResult updateYpwtsc(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateYpwtsc(buffer);
    }

    @Log(title = "药品委托生产-删除")
    @ApiOperation(value = "药品委托生产-删除")
    @DeleteMapping(value = "deleteYpwtsc")
    public HttpResult deleteYpwtsc(@RequestParam(value = "ids",defaultValue = "")String ids){
        return spcyQyInfoService.deleteYpwtsc(ids);
    }

    /************************************[ 企业-产值 ]**************************************************************************/

    @Log(title = "企业产值-分页查询-根据企业id")
    @ApiOperation(value = "企业产值-分页查询-根据企业id")
    @GetMapping(value = "getCzPage")
    public HttpResult<?> getCzPage(SpcyQyCz query, PageVo pageVo) {
        if (StringUtils.isBlank(query.getFqyid())){
            return HttpResult.error("企业参数为空！");
        }
        return spcyQyInfoService.queryCzPageList(query, pageVo.getPageNo(), pageVo.getPageSize());
    }

    @Log(title = "企业产值-添加-根据企业id")
    @ApiOperation(value = "企业产值-添加-根据企业id")
    @PostMapping(value = "addQyCz")
    public HttpResult addQyCz(@RequestBody SpcyQyCz bean) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(bean.getId())){
            return spcyQyInfoService.updateCz((HashMap<String, String>) BeanUtils.describe(bean));
        }

        return spcyQyInfoService.addCz(bean, false);
    }

    @Log(title = "企业产值-更新")
    @ApiOperation(value = "企业产值-更新")
    @PutMapping(value = "updateQyCz")
    public HttpResult updateQyCz(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateCz(buffer);
    }

    @Log(title = "企业产值-删除")
    @ApiOperation(value = "企业产值-删除")
    @DeleteMapping(value = "deleteQyCz")
    public HttpResult deleteQyCz(@RequestParam(value = "ids",defaultValue = "")String ids){
        return spcyQyInfoService.deleteCz(ids);
    }

    /************************************[ 企业-研发投入 ]**************************************************************************/

    @Log(title = "企业研发投入-分页查询-根据企业id")
    @ApiOperation(value = "企业研发投入-分页查询-根据企业id")
    @GetMapping(value = "getYftrPage")
    public HttpResult<?> getYftrPage(SpcyQyYftr query, PageVo pageVo) {
        if (StringUtils.isBlank(query.getFqyid())){
            return HttpResult.error("企业参数为空！");
        }
        return spcyQyInfoService.queryYftrPageList(query, pageVo.getPageNo(), pageVo.getPageSize());
    }

    @Log(title = "企业研发投入-添加-根据企业id")
    @ApiOperation(value = "企业研发投入-添加-根据企业id")
    @PostMapping(value = "addQyYftr")
    public HttpResult addQyYftr(@RequestBody SpcyQyYftr bean) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(bean.getId())){
            return spcyQyInfoService.updateYftr((HashMap<String, String>) BeanUtils.describe(bean));
        }

        return spcyQyInfoService.addYftr(bean, false);
    }

    @Log(title = "企业研发投入-更新")
    @ApiOperation(value = "企业研发投入-更新")
    @PutMapping(value = "updateQyYftr")
    public HttpResult updateQyYftr(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateYftr(buffer);
    }

    @Log(title = "企业研发投入-删除")
    @ApiOperation(value = "企业研发投入-删除")
    @DeleteMapping(value = "deleteQyYftr")
    public HttpResult deleteQyYftr (@RequestParam(value = "ids",defaultValue = "")String ids){
        return spcyQyInfoService.deleteYftr(ids);
    }

    /************************************[ 企业-生产环境监控 ]**************************************************************************/

    @Log(title = "生产车间使用记录-分页查询")
    @ApiOperation(value = "生产车间使用记录-分页查询")
    @GetMapping(value = "querySccjjlPageList")
    public HttpResult<?> querySccjjlPageList(SpcyQySccjjl query,
                                             @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                             @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {

        return spcyQyInfoService.querySccjjlPageList(query, pageNo,pageSize);
    }

    @Log(title = "车间环境监控-分页查询")
    @ApiOperation(value = "车间环境监控-分页查询")
    @GetMapping(value = "querySccjHjjlPageList")
    public HttpResult<?> querySccjHjjlPageList(SpcyQySchj query,
                                               @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                               @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {
        return spcyQyInfoService.querySccjHjjlPageList(query,pageNo,pageSize);
    }

    @Log(title = "车间环境监控-添加")
    @ApiOperation(value = "车间环境监控-添加")
    @PostMapping(value = "addSccjHjjl")
    public HttpResult addSccjHjjl(@RequestBody SpcyQySchj bean) {
        spcyQyInfoService.addSccjHjjl(bean);
        return HttpResult.ok("保存成功");
    }

    @Log(title = "车间环境监控-删除")
    @ApiOperation(value = "车间环境监控-删除")
    @DeleteMapping(value = "deleteSccjHjjl")
    public HttpResult deleteSccjHjjl(@RequestParam(value = "id",defaultValue = "")String id){
        spcyQyInfoService.deleteSccjHjjl(id);
        return HttpResult.ok("删除成功");
    }

    /************************************[ 企业-生产记录 ]**************************************************************************/

    @Log(title = "生产记录-分页查询")
    @ApiOperation(value = "生产记录-分页查询")
    @GetMapping(value = "queryScjlPageList")
    public HttpResult<?> queryScjlPageList(SpcyQyScjl query,
                                           @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                           @RequestParam(value = "pageSize",defaultValue = "5")Integer pageSize) {
        return spcyQyInfoService.queryScjlPageList(query,pageNo,pageSize);
    }

    @Log(title = "生产记录-添加")
    @ApiOperation(value = "生产记录-添加")
    @PostMapping(value = "addScjl")
    public HttpResult addScjl(@RequestBody SpcyQyScjl bean) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(bean.getId())){
            return spcyQyInfoService.updateScjl((HashMap<String, String>) BeanUtils.describe(bean));
        }
        return spcyQyInfoService.addScjl(bean);
    }

    @Log(title = "生产记录-更新")
    @ApiOperation(value = "生产记录-更新")
    @PutMapping(value = "updateScjl")
    public HttpResult updateScjl(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateScjl(buffer);
    }

    @Log(title = "生产记录-删除")
    @ApiOperation(value = "生产记录-删除")
    @DeleteMapping(value = "deleteScjl")
    public HttpResult deleteScjl(String id){
        spcyQyInfoService.deleteScjl(id);
        return HttpResult.ok("删除成功");
    }

    @Log(title = "查询生产记录物料列表")
    @ApiOperation(value = "查询生产记录物料列表")
    @GetMapping(value = "queryScjlWlList")
    public HttpResult<?> queryScjlWlList(@RequestParam(value = "fscjlid",defaultValue = "")String fscjlid) {
        if (StringUtils.isBlank(fscjlid)){
            throw new BusinessException("生产记录数据参数为空！");
        }
        List<QyScjlWlParamBo> list = spcyQyInfoService.queryScjlWlList(fscjlid);
        return HttpResultVo.HttpResultList(list);
    }

    @Log(title = "添加生产记录物料")
    @ApiOperation(value = "添加生产记录物料")
    @GetMapping(value = "addScjlWl")
    public HttpResult addScjlWl(@RequestParam(value = "fscjlid",defaultValue = "")String fscjlid,
                                @RequestParam(value = "fwlmlid",defaultValue = "")String fwlmlid,
                                @RequestParam(value = "fwlsysl",defaultValue = "0")Integer fwlsysl){
        spcyQyInfoService.addScjlWl(fscjlid, fwlmlid, fwlsysl);

        return HttpResult.ok("添加成功");
    }

    @Log(title = "修改生产记录物料使用量")
    @ApiOperation(value = "修改生产记录物料使用量")
    @GetMapping(value = "modifyScjlWl")
    public HttpResult modifyScjlWl(@RequestParam(value = "id",defaultValue = "")String id,
                                @RequestParam(value = "fwlsysl",defaultValue = "")Integer fwlsysl){
        spcyQyInfoService.modifyScjlWl(id, fwlsysl);

        return HttpResult.ok("保存成功");
    }

    @Log(title = "删除生产记录物料")
    @ApiOperation(value = "删除生产记录物料")
    @DeleteMapping(value = "deleteScjlwl")
    public HttpResult deleteScjlwl(@RequestParam(value = "id",defaultValue = "")String id){
        spcyQyInfoService.deleteScjlwl(id);

        return HttpResult.ok("删除成功");
    }

    @Log(title = "查询生产记录使用车间列表")
    @ApiOperation(value = "查询生产记录使用车间列表")
    @GetMapping(value = "querySccjSyjlList")
    public HttpResult<?> querySccjSyjlList(@RequestParam(value = "fscjlid",defaultValue = "")String fscjlid) {
        if (StringUtils.isBlank(fscjlid)){
            throw new BusinessException("生产记录数据参数为空！");
        }
        List<SpcyQySccjjl> list = spcyQyInfoService.querySccjSyjlList(fscjlid, null);
        return HttpResultVo.HttpResultList(list);
    }

    @Log(title = "添加生产记录使用车间")
    @ApiOperation(value = "添加生产记录使用车间")
    @PostMapping(value = "addScjlSycj")
    public HttpResult addScjlSycj(@RequestBody SpcyQySccjjl paramBo) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {

        if (StringUtils.isNotBlank(paramBo.getId())){
            return spcyQyInfoService.updateScjlSycj((HashMap<String, String>) BeanUtils.describe(paramBo));
        }
        return spcyQyInfoService.addScjlSycj(paramBo);
    }

    @Log(title = "更新生产记录使用车间")
    @ApiOperation(value = "更新生产记录使用车间")
    @PutMapping(value = "updateScjlSycj")
    public HttpResult updateScjlSycj(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateScjlSycj(buffer);
    }

    @Log(title = "删除生产记录使用车间")
    @ApiOperation(value = "删除生产记录使用车间")
    @DeleteMapping(value = "deleteScjlSycj")
    public HttpResult deleteScjlSycj(@RequestParam(value = "id",defaultValue = "")String id){
        spcyQyInfoService.deleteScjlSycj(id);

        return HttpResult.ok("删除成功");
    }

    /************************************[ 企业-检验信息 ]**************************************************************************/

    @Log(title = "检验信息-列表查询")
    @ApiOperation(value = "检验信息-列表查询")
    @GetMapping(value = "queryQyJyxxList")
    public HttpResult queryQyJyxxList(QyJyxxDto query){

        Map result = new HashMap();
        if (StringUtils.isBlank(query.getFscjlid())){
            throw new BusinessException("生产记录参数为空！");
        }
        result.put("records", spcyQyInfoService.queryQyJyxxList(query));
        return HttpResult.ok(result);
    }

    @Log(title = "检验信息-添加")
    @ApiOperation(value = "检验信息-添加")
    @PostMapping(value = "addJyxx")
    public HttpResult addJyxx(@RequestBody SpcyQyJyxx bean) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(bean.getId())){
            return spcyQyInfoService.updateJyxx((HashMap<String, String>) BeanUtils.describe(bean));
        }
        return spcyQyInfoService.addJyxx(bean);
    }

    @Log(title = "检验信息-更新")
    @ApiOperation(value = "检验信息-更新")
    @PutMapping(value = "updateJyxx")
    public HttpResult updateJyxx(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateJyxx(buffer);
    }

    @Log(title = "检验信息-删除")
    @ApiOperation(value = "检验信息-删除")
    @DeleteMapping(value = "deleteJyxx")
    public HttpResult deleteJyxx(@RequestParam(value = "id",defaultValue = "")String id){
        spcyQyInfoService.deleteJyxx(id);

        return HttpResult.ok("删除成功");
    }

    @Log(title = "检验信息文件上传")
    @ApiOperation(value = "检验信息文件上传")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "file",value = "需要上传的文件，文件不能为空",required = true),
            @ApiImplicitParam(name = "id",value = "检验id",required = true)
    })
    @PostMapping(value = "/uploadQyJyxxFile")
    public HttpResult<?> uploadQyJyxxFile(@RequestPart("file") MultipartFile[] file,
                                        @RequestParam(value = "id",defaultValue = "") String id){
        SpcyQyWjjl spcyQyWjjl = new SpcyQyWjjl();
        spcyQyWjjl.setFwjlx1(SpcyCommonConstant.QY_JYJL_WJLX_JYJL);
        return spcyQyInfoService.uploadMoreTypeFile(file,id,spcyQyWjjl);
    }

    @Log(title = "获取检验信息相关附件")
    @ApiOperation(value = "获取检验信息相关附件")
    @GetMapping(value = "/queryQyJyxxFileList")
    public HttpResult<?> queryQyJyxxFileList(@RequestParam(value = "id",defaultValue = "") String id){
        return HttpResult.ok(spcyQyInfoService.queryQyFileList(id));
    }

    /************************************[ 企业-检验项目 ]**************************************************************************/

    @Log(title = "检验项目-列表查询")
    @ApiOperation(value = "检验项目-列表查询")
    @GetMapping(value = "queryQyJyxmList")
    public HttpResult queryQyJyxmList(SpcyQyJcxm query){

        if (StringUtils.isBlank(query.getFjyid())){
            throw new BusinessException("检验参数为空！");
        }
        Map result = new HashMap();
        result.put("records", spcyQyInfoService.queryQyJyxmList(query));
        return HttpResult.ok(result);
    }

    @Log(title = "检验项目-添加")
    @ApiOperation(value = "检验项目-添加")
    @PostMapping(value = "addJyxm")
    public HttpResult addJyxm(@RequestBody SpcyQyJcxm bean) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(bean.getId())){
            return spcyQyInfoService.updateJyxm((HashMap<String, String>) BeanUtils.describe(bean));
        }
        return spcyQyInfoService.addJyxm(bean);
    }

    @Log(title = "检验项目-更新")
    @ApiOperation(value = "检验项目-更新")
    @PutMapping(value = "updateJyxm")
    public HttpResult updateJyxm(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateJyxm(buffer);
    }

    @Log(title = "检验项目-删除")
    @ApiOperation(value = "检验项目-删除")
    @DeleteMapping(value = "deleteJyxm")
    public HttpResult deleteJyxm(@RequestParam(value = "id",defaultValue = "")String id){
        spcyQyInfoService.deleteJyxm(id);

        return HttpResult.ok("删除成功");
    }

    /************************************[ 企业-企业委托 ]**************************************************************************/

    @Log(title = "企业委托-分页列表查询")
    @ApiOperation(value = "企业委托-分页列表查询")
    @GetMapping(value = "queryQyWtxxPageList")
    public HttpResult queryQyWtxxPageList(SpcyQyQywtxx query,
                                          @RequestParam(value = "pageNo",defaultValue = "1")Integer pageNo,
                                          @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize){
        return spcyQyInfoService.queryQyWtxxPageList(query,pageNo,pageSize);
    }

    @Log(title = "企业委托-添加/更新")
    @ApiOperation(value = "企业委托-添加/更新")
    @PostMapping(value = "saveQyWtxx")
    public HttpResult saveQyWtxx(@RequestBody SpcyQyQywtxx bean) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(bean.getId())){
            return spcyQyInfoService.updateQywtxx((HashMap<String, String>) BeanUtils.describe(bean));
        }
        return spcyQyInfoService.addQywtxx(bean);
    }

    @Log(title = "企业委托-删除")
    @ApiOperation(value = "企业委托-删除")
    @DeleteMapping(value = "deleteQyWtxx")
    public HttpResult deleteQyWtxx(@RequestParam(value = "ids",defaultValue = "")String ids){
        spcyQyInfoService.deleteQyWtxx(ids);

        return HttpResult.ok("删除成功");
    }

    /************************************[ 企业-设备信息 ]**************************************************************************/

    @Log(title = "设备信息-分页列表查询")
    @ApiOperation(value = "设备信息-分页列表查询")
    @GetMapping(value = "queryQySbxxPageList")
    public HttpResult queryQySbxxPageList(SpcyQySbxx query,
                                          @RequestParam(value = "gjz",defaultValue = "")String gjz,
                                          @RequestParam(value = "pageNo",defaultValue = "1")Integer pageNo,
                                          @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize){
        return spcyQyInfoService.queryQySbxxPageList(query,gjz,pageNo,pageSize);
    }

    @Log(title = "设备信息-添加/更新")
    @ApiOperation(value = "设备信息-添加/更新")
    @PostMapping(value = "saveQySbxx")
    public HttpResult saveQySbxx(@RequestBody SpcyQySbxx bean) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(bean.getId())){
            return spcyQyInfoService.updateQySbxx((HashMap<String, String>) BeanUtils.describe(bean));
        }
        return spcyQyInfoService.addQySbxx(bean);
    }

    @Log(title = "设备信息-删除")
    @ApiOperation(value = "设备信息-删除")
    @DeleteMapping(value = "deleteQySbxx")
    public HttpResult deleteQySbxx(@RequestParam(value = "ids",defaultValue = "")String ids){
        spcyQyInfoService.deleteQySbxx(ids);

        return HttpResult.ok("删除成功");
    }

    /************************************[ 企业-关键指标 ]**************************************************************************/

    @Log(title = "关键指标-分页查询")
    @ApiOperation(value = "关键指标-分页查询")
    @GetMapping(value = "queryQyGjzbPageList")
    public HttpResult<?> queryQyGjzbPageList(SpcyQyGjzb query,
                                         @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                         @RequestParam(value = "pageSize",defaultValue = "5")Integer pageSize) {
        return spcyQyInfoService.queryQyGjzbPageList(query,pageNo,pageSize);
    }

    @Log(title = "关键指标-添加")
    @ApiOperation(value = "关键指标-添加")
    @PostMapping(value = "addGjzb")
    public HttpResult addGjzb(@RequestBody SpcyQyGjzb bean) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(bean.getId())){
            return spcyQyInfoService.updateGjzb((HashMap<String, String>) BeanUtils.describe(bean));
        }
        return spcyQyInfoService.addGjzb(bean);
    }

    @Log(title = "关键指标-更新")
    @ApiOperation(value = "关键指标-更新")
    @PutMapping(value = "updateGjzb")
    public HttpResult updateGjzb(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateGjzb(buffer);
    }

    @Log(title = "关键指标-删除")
    @ApiOperation(value = "关键指标-删除")
    @DeleteMapping(value = "deleteGjzb")
    public HttpResult deleteGjzb(@RequestParam(value = "id",defaultValue = "")String id){
        spcyQyInfoService.deleteGjzb(id);

        return HttpResult.ok("删除成功");
    }

    /************************************[ 企业-物料目录 ]**************************************************************************/

    @Log(title = "物料目录-分页查询")
    @ApiOperation(value = "物料目录-分页查询")
    @GetMapping(value = "queryWlmlPageList")
    public HttpResult<?> queryWlmlPageList(SpcyQyWlml query,
                                           @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                           @RequestParam(value = "pageSize",defaultValue = "5")Integer pageSize) {
        if (StringUtils.isBlank(query.getFqyid())){
            return HttpResult.error("企业参数id不能为空");
        }
        return spcyQyInfoService.queryWlmlPageList(query,pageNo,pageSize);
    }

    @Log(title = "获取所有物料目录列表")
    @ApiOperation(value = "获取所有物料目录列表")
    @GetMapping(value = "queryAllWlmlList")
    public HttpResult<?> queryAllWlmlList(SpcyQyWlml query) {

        List<SpcyQyWlml> list = spcyQyInfoService.queryAllWlmlList(query);
        return HttpResult.ok(list);
    }

    @Log(title = "获取所有物料库存-分页列表")
    @ApiOperation(value = "获取所有物料库存-分页列表")
    @GetMapping(value = "queryAllWlKcList")
    public HttpResult<?> queryAllWlKcList(WlkcParamBo query,
                                          @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                          @RequestParam(value = "pageSize",defaultValue = "5")Integer pageSize) {
        return spcyQyInfoService.queryAllWlKcList(query,pageNo,pageSize);
    }

    @Log(title = "物料统计-分页列表")
    @ApiOperation(value = "物料统计-分页列表")
    @GetMapping(value = "QueryWlStatList")
    public HttpResult<?> QueryWlStatList(WlStatListDto query,
                                         @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                         @RequestParam(value = "pageSize",defaultValue = "5")Integer pageSize) {
        return spcyQyInfoService.QueryWlStatList(query,pageNo,pageSize);
    }

    @Log(title = "物料目录-添加")
    @ApiOperation(value = "物料目录-添加")
    @PostMapping(value = "addWlml")
    public HttpResult addWlml(@RequestBody SpcyQyWlml bean,
                              @RequestParam(value = "onlyCurrentUser", defaultValue = "false") boolean onlyCurrentUser) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(bean.getId())){
            return spcyQyInfoService.updateWlml((HashMap<String, String>) BeanUtils.describe(bean));
        }
        return spcyQyInfoService.addWlml(bean,onlyCurrentUser);
    }

    @Log(title = "物料目录-更新")
    @ApiOperation(value = "物料目录-更新")
    @PutMapping(value = "updateWlml")
    public HttpResult updateWlml(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateWlml(buffer);
    }

    @Log(title = "物料目录-删除")
    @ApiOperation(value = "物料目录-删除")
    @DeleteMapping(value = "deleteWlml")
    public HttpResult deleteWlml(@RequestParam(value = "ids",defaultValue = "")String ids){
        return spcyQyInfoService.deleteWlml(ids);
    }

    /************************************[ 企业-物料目录库存 ]**************************************************************************/

    @Log(title = "新增-物料与供应商审计关系")
    @ApiOperation(value = "新增-物料与供应商审计关系")
    @GetMapping(value = "addWlgyssjGx")
    public HttpResult addWlgyssjGx(@RequestParam(value = "fwlmlid",defaultValue = "")String wlmlid,
                                   @RequestParam(value = "fwlsjid",defaultValue = "")String wlsjid){
        spcyQyInfoService.addWlgyssjGx(wlmlid, wlsjid);
        return HttpResult.ok("保存成功");
    }

    @Log(title = "删除-物料与供应商审计关系")
    @ApiOperation(value = "删除-物料与供应商审计关系")
    @DeleteMapping(value = "deleteWlgyssjGx")
    public HttpResult deleteWlgyssjGx(@RequestParam(value = "id",defaultValue = "")String id){
        spcyQyInfoService.deleteWlgyssjGx(id);
        return HttpResult.ok("删除成功");
    }

    @Log(title = "获取物料与供应商审计列表")
    @ApiOperation(value = "获取物料与供应商审计列表")
    @GetMapping(value = "queryWlgyssjBySjIdList")
    public HttpResult queryWlgyssjBySjIdList(@RequestParam(value = "fwlsjid",defaultValue = "")String wlsjid){
        List<WlGyssjParamBo> list = spcyQyInfoService.queryWlgyssjBySjIdList(wlsjid);
        return HttpResult.ok(list);
    }

    @Log(title = "获取对应物料目录的供应商审计")
    @ApiOperation(value = "获取对应物料目录的供应商审计")
    @GetMapping(value = "queryGyssjByWlIdList")
    public HttpResult queryGyssjByWlIdList(@RequestParam(value = "fwlmlid",defaultValue = "")String fwlmlid){
        List<QyYlgyssjYjxxParamBo> list = spcyQyInfoService.queryGyssjByWlIdList(fwlmlid);
        return HttpResult.ok(list);
    }

    @Log(title = "获取物料库存-分页列表")
    @ApiOperation(value = "获取物料库存-分页列表")
    @GetMapping(value = "queryWlkcPageList")
    public HttpResult queryWlkcPageList(WlkcParamBo query,
                                    @RequestParam(value = "pageNo",defaultValue = "1")Integer pageNo,
                                    @RequestParam(value = "pageSize",defaultValue = "5")Integer pageSize){
        return spcyQyInfoService.queryWlkcPageList(query, pageNo, pageSize);
    }

    @Log(title = "库存查看")
    @ApiOperation(value = "库存查看")
    @GetMapping(value = "viewKc")
    public HttpResult viewKc(@RequestParam(value = "id",defaultValue = "") String id){

        Map result = new HashMap();
        result.put("kc", spcyQyInfoService.queryWlkcById(id));
        result.put("jlList", spcyQyInfoService.queryWlkcjl(id));
        return HttpResult.ok(result);
    }

    @Log(title = "物料库存-新增")
    @ApiOperation(value = "物料库存-新增")
    @PostMapping(value = "addWlkc")
    public HttpResult addWlkc(@RequestBody SpcyQyWlkc bean) {

        SpcyQyWlkc wlkc = spcyQyInfoService.addWlkc(bean);
        HttpResult httpResult = new HttpResult(true);
        httpResult.setResult(wlkc);
        httpResult.setMessage("保存成功");
        return httpResult;
    }

    @Log(title = "物料库存-更新")
    @ApiOperation(value = "物料库存-更新")
    @PutMapping(value = "updateWlkc")
    public HttpResult updateWlkc(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        spcyQyInfoService.updateWlkc(buffer);
        return HttpResult.ok("保存成功");
    }

    @Log(title = "物料库存-删除")
    @ApiOperation(value = "物料库存-删除")
    @DeleteMapping(value = "deleteWlkc")
    public HttpResult deleteWlkc(@RequestParam(value = "ids",defaultValue = "")String ids){
        spcyQyInfoService.deleteWlkc(ids);
        return HttpResult.ok("删除成功");
    }

    /************************************[ 企业-违法违纪 ]**************************************************************************/

    @Log(title = "企业违法违纪库-分页查询")
    @ApiOperation(value = "企业违法违纪库-分页查询")
    @GetMapping(value = "queryQyWfjlBasicPageList")
    public HttpResult<?> queryQyWfjlBasicPageList(QyWfjlVo wfwjjl,
                                                  @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                                  @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {
        Page<QyWfjlVo> page = new Page<>(pageNo, pageSize);
        IPage<QyWfjlVo> pageList = spcyQyWfwjjlMapper.selectQyWfjl(page, wfwjjl);
        return HttpResult.ok(pageList);
    }


    @Log(title = "企业个人违法违纪-分页查询")
    @ApiOperation(value = "企业个人违法违纪-分页查询")
    @GetMapping(value = "queryQyWfwjjlPageList")
    public HttpResult<?> queryQyWfwjjlPageList(SpcyQyWfwjjl wfwjjl, @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                             @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {
        if (StringUtils.isBlank(wfwjjl.getFqyid())){
            return HttpResult.error("企业参数id不能为空");
        }
        return spcyQyInfoService.queryQyWfwjjlPageList(wfwjjl,pageNo,pageSize);
    }

    @Log(title = "违法违纪-添加")
    @ApiOperation(value = "违法违纪-添加")
    @PostMapping(value = "addQyWfwjjl")
    public HttpResult addQyWfwjjl(@RequestBody SpcyQyWfwjjl wfwjjl,
                                @RequestParam(value = "onlyCurrentUser", defaultValue = "false") boolean onlyCurrentUser) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(wfwjjl.getId())){
            return spcyQyInfoService.updateJcxx((HashMap<String, String>) BeanUtils.describe(wfwjjl));
        }
        return spcyQyInfoService.addQyWfwjjl(wfwjjl,onlyCurrentUser);
    }

    @Log(title = "违法违纪-更新")
    @ApiOperation(value = "违法违纪-更新")
    @PutMapping(value = "updateWfwjjl")
    public HttpResult updateWfwjjl(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateWfwjjl(buffer);
    }

    @Log(title = "违法违纪-清空")
    @ApiOperation(value = "违法违纪-清空")
    @DeleteMapping(value = "emptyWfjl")
    public HttpResult<?> emptyWfjl(@RequestParam("fqyid") String fqyid){
        return spcyQyInfoService.emptyWfjl(fqyid);
    }

    @Log(title = "违法违纪-删除")
    @ApiOperation(value = "违法违纪-删除")
    @DeleteMapping(value = "deleteWfwjjl")
    public HttpResult deleteWfwjjl(@RequestParam(value = "ids",defaultValue = "")String ids){
        return spcyQyInfoService.deleteWfwjjl(ids);
    }

    @Log(title = "违法违纪-通过id查询")
    @ApiOperation(value = "违法违纪-通过id查询")
    @DeleteMapping(value = "queryWfwjjlById")
    public HttpResult<?> queryWfwjjlById(@RequestParam(value = "id",defaultValue = "")String id) {
        return spcyQyInfoService.queryWfwjjlById(id);
    }

    /************************************[ 企业-人员类型 ]**************************************************************************/

    @Log(title = "人员类型-分页查询")
    @ApiOperation(value = "人员类型-分页查询")
    @GetMapping(value = "queryRylxPageList")
    public HttpResult<?> queryRylxPageList(SpcyQyRylx rylx, @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                             @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize) {
        return spcyQyInfoService.queryRylxPageList(rylx,pageNo,pageSize);
    }

    @Log(title = "获取所有的人员类型")
    @ApiOperation(value = "获取所有的人员类型")
    @GetMapping(value = "queryAllRylxList")
    public HttpResult<?> queryAllRylxList() {
        return spcyQyInfoService.queryAllRylxList();
    }

    @Log(title = "人员类型-添加")
    @ApiOperation(value = "人员类型-添加")
    @PostMapping(value = "addRylx")
    public HttpResult addRylx(@RequestBody SpcyQyRylx rylx,
                                @RequestParam(value = "onlyCurrentUser", defaultValue = "false") boolean onlyCurrentUser) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
        if (StringUtils.isNotBlank(rylx.getId())){
            return spcyQyInfoService.updateRylx((HashMap<String, String>) BeanUtils.describe(rylx));
        }
        return spcyQyInfoService.addRylx(rylx,onlyCurrentUser);
    }

    @Log(title = "人员类型-更新")
    @ApiOperation(value = "人员类型-更新")
    @PutMapping(value = "updateRylx")
    public HttpResult updateRylx(@RequestBody HashMap<String, String> buffer) throws InvocationTargetException, IllegalAccessException {
        return spcyQyInfoService.updateRylx(buffer);
    }

    @Log(title = "人员类型-删除")
    @ApiOperation(value = "人员类型-删除")
    @DeleteMapping(value = "deleteRylx")
    public HttpResult deleteRylx(@RequestParam(value = "ids",defaultValue = "")String ids){
        return spcyQyInfoService.deleteRylx(ids);
    }

    @Log(title = "人员类型-通过id查询")
    @ApiOperation(value = "人员类型-通过id查询")
    @DeleteMapping(value = "queryRylxById")
    public HttpResult<?> queryRylxById(@RequestParam(value = "id",defaultValue = "")String id) {
        return spcyQyInfoService.queryRylxById(id);
    }

    /************************************[ 企业-文件记录 ]**************************************************************************/

    @Log(title = "多类型文件上传")
    @ApiOperation(value = "多类型文件上传")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "file",value = "需要上传的文件，文件不能为空",required = true),
            @ApiImplicitParam(name = "id",value = "相关业务数据id",required = true)
    })
    @PostMapping(value = "/uploadMoreTypeFile")
    public HttpResult<?> uploadMoreTypeFile(@RequestPart("file") MultipartFile[] file,
                                            @RequestParam("id") String id,
                                            SpcyQyWjjl spcyQyWjjl){
        return spcyQyInfoService.uploadMoreTypeFile(file,id,spcyQyWjjl);
    }

    @Log(title = "企业附件文件下载-根据附件id")
    @ApiOperation(value = "企业附件文件下载-根据附件id")
    @GetMapping(value = "/getCrossLocalFile")
    public void getCrossLocalFile(@RequestParam(value = "id",defaultValue = "") String fileId, HttpServletResponse response) {
        spcyQyInfoService.getCrossLocalFile(fileId,response);
    }

    @Log(title = "企业删除文件附件")
    @ApiOperation(value = "企业删除文件附件")
    @DeleteMapping(value = "deleteFileById")
    public HttpResult<?> deleteFileById(@RequestParam(value = "id",defaultValue = "") String fileId){
        return spcyQyInfoService.deleteFileById(fileId);
    }

    /************************************[ 企业-文件记录 ]**************************************************************************/

    @Log(title = "设备确认信息-文件目录")
    @ApiOperation(value = "设备确认信息-文件目录")
    @ApiImplicitParam(name = "id",value = "设备确认信息id")
    @GetMapping(value = "querySbqrxxWjml")
    public HttpResult<?> querySbqrxxWjml(@RequestParam(value = "id",defaultValue = "") String id){
        List<Map> mapList = spcyQyInfoService.queryWjljByWjml(id, "设备确认信息");
        return HttpResult.ok(mapList);
    }

    @Log(title = "原料供应商审计-文件目录")
    @ApiOperation(value = "原料供应商审计-文件目录")
    @ApiImplicitParam(name = "id",value = "原料供应商审计id")
    @GetMapping(value = "queryYlgyssjWjml")
    public HttpResult<?> queryYlgyssjWjml(@RequestParam(value = "id",defaultValue = "") String id){
        List<Map> mapList = spcyQyInfoService.queryWjljByWjml(id, "原料供应商审计");
        return HttpResult.ok(mapList);
    }

    @Log(title = "清洁验证-文件目录")
    @ApiOperation(value = "清洁验证-文件目录")
    @ApiImplicitParam(name = "id",value = "清洁验证id")
    @GetMapping(value = "queryQjyzWjml")
    public HttpResult<?> queryQjyzWjml(@RequestParam(value = "id",defaultValue = "") String id){
        List<Map> mapList = spcyQyInfoService.queryWjljByWjml(id, "清洁验证");
        return HttpResult.ok(mapList);
    }

    @Log(title = "工艺验证-文件目录")
    @ApiOperation(value = "工艺验证-文件目录")
    @ApiImplicitParam(name = "id",value = "工艺验证id")
    @GetMapping(value = "queryGyyzWjml")
    public HttpResult<?> queryGyyzWjml(@RequestParam(value = "id",defaultValue = "") String id){
        List<Map> mapList = spcyQyInfoService.queryWjljByWjml(id, "工艺验证");
        return HttpResult.ok(mapList);
    }

    @Log(title = "检查信息-文件目录")
    @ApiOperation(value = "检查信息-文件目录")
    @ApiImplicitParam(name = "id",value = "检查信息id")
    @GetMapping(value = "queryJcxxWjml")
    public HttpResult<?> queryJcxxWjml(@RequestParam(value = "id",defaultValue = "") String id){
        List<Map> mapList = spcyQyInfoService.queryWjljByWjml(id, "检查信息");
        return HttpResult.ok(mapList);
    }

    @Log(title = "产品偏差-文件目录")
    @ApiOperation(value = "产品偏差-文件目录")
    @ApiImplicitParam(name = "id",value = "产品偏差id")
    @GetMapping(value = "queryCppcxxWjml")
    public HttpResult<?> queryCppcxxWjml(@RequestParam(value = "id",defaultValue = "") String id){
        List<Map> mapList = spcyQyInfoService.queryWjljByWjml(id, "产品偏差");
        return HttpResult.ok(mapList);
    }

    @Log(title = "变更控制-文件目录")
    @ApiOperation(value = "变更控制-文件目录")
    @ApiImplicitParam(name = "id",value = "产品偏差id")
    @GetMapping(value = "queryBgkzWjml")
    public HttpResult<?> queryBgkzWjml(@RequestParam(value = "id",defaultValue = "") String id){
        List<Map> mapList = spcyQyInfoService.queryWjljByWjml(id, "变更控制");
        return HttpResult.ok(mapList);
    }

    @Log(title = "物料库存-文件目录")
    @ApiOperation(value = "物料库存-文件目录")
    @ApiImplicitParam(name = "id",value = "库存id")
    @GetMapping(value = "queryWlkcWjml")
    public HttpResult<?> queryWlkcWjml(@RequestParam(value = "id",defaultValue = "") String id){
        List<Map> mapList = spcyQyInfoService.queryWjljByWjml(id, "物料入库");
        return HttpResult.ok(mapList);
    }

    @Log(title = "检验记录-文件目录")
    @ApiOperation(value = "检验记录-文件目录")
    @ApiImplicitParam(name = "id",value = "生产记录id")
    @GetMapping(value = "queryJyjlWjml")
    public HttpResult<?> queryJyjlWjml(@RequestParam(value = "id",defaultValue = "") String id){
        List<Map> mapList = spcyQyInfoService.queryWjljByWjml(id, "检验记录");
        return HttpResult.ok(mapList);
    }

    @Log(title = "关键人员-文件目录")
    @ApiOperation(value = "关键人员-文件目录")
    @ApiImplicitParam(name = "id",value = "人员id")
    @GetMapping(value = "queryGjryWjml")
    public HttpResult<?> queryGjryWjml(@RequestParam(value = "id",defaultValue = "") String id){
        List<Map> mapList = spcyQyInfoService.queryWjljByWjml(id, "关键人员");
        return HttpResult.ok(mapList);
    }

    @Log(title = "生产工艺-文件记录-根据品种查询")
    @ApiOperation(value = "生产工艺-文件记录-根据品种查询")
    @GetMapping(value = "queryScgyWj")
    public HttpResult<?> queryScgyWj(@RequestParam(value = "fpzid",defaultValue = "0") @ApiParam("品种id") String fpzid){

        return HttpResultVo.HttpResultList(spcyQyInfoService.selectCommonWjjl(fpzid, "生产工艺"));
    }

    @Log(title = "附件复制")
    @ApiOperation(value = "附件复制")
    @GetMapping(value = "copyFj")
    public HttpResult<?> copyFj(@RequestParam(value = "id",defaultValue = "0") @ApiParam("文件id") String id){

        Result result = spcyQyInfoService.copyWjjl(id);
        if (!result.isSuccess()){
            return HttpResult.error(result.getMessage());
        }

        return HttpResult.ok("操作成功");
    }

    @Log(title = "附件信息修改")
    @ApiOperation(value = "附件信息修改")
    @PostMapping(value = "updateFj")
    public HttpResult<?> updateFj(@RequestBody SpcyQyWjjl reqVo){

        return spcyQyInfoService.updateWj(reqVo);
    }

    @Log(title = "生产工艺-文件新增上传")
    @ApiOperation(value = "生产工艺-文件新增上传")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "file",value = "需要上传的文件",required = true)
    })
    @PostMapping(value = "/uploadScgyFile")
    public HttpResult<?> uploadScgyFile(HttpServletRequest request,
                                        @RequestParam(value = "fpzid",defaultValue = "") @ApiParam("品种id") String fpzid,
                                        @RequestParam(value = "fwjxsmc",defaultValue = "") @ApiParam("附件名称") String fwjxsmc,
                                        @RequestParam(value = "fwjlx5",defaultValue = "") @ApiParam("附件说明") String fwjlx5,
                                        @RequestParam(value = "fwjlx6",defaultValue = "") @ApiParam("附件备注") String fwjlx6
    ){
        if (StringUtils.isBlank(fpzid)){
            return HttpResult.error("品种参数为空！");
        }

        if (StringUtils.isNotBlank(fwjxsmc)){
            String validFileName = StringPatternUtils.isValidFileName(fwjxsmc);
            if (StringUtils.isNotBlank(validFileName)){
                return HttpResult.error("附件名称不能存在特殊字符："+validFileName);
            }
        }

        try {
            SpcyQyWjjl wjjl = spcyQyInfoService.uploadCommonParts(request.getParts(), fpzid, "生产工艺", fwjxsmc, fwjlx5, fwjlx6);

            return HttpResultVo.HttpResultSave(wjjl, "上传成功");
        }catch (Exception e){
            return HttpResult.error("上传失败！");
        }
    }

    @Log(title = "生产工艺-文件替换上传")
    @ApiOperation(value = "生产工艺-文件替换上传")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "file",value = "需要上传的文件，文件不能为空",required = true)
    })
    @PostMapping(value = "/uploadThgyFile")
    public HttpResult<?> uploadThgyFile(HttpServletRequest request,
                                        @RequestParam(value = "id",defaultValue = "") @ApiParam("文件id") String id
    ){
        if (StringUtils.isBlank(id)){
            return HttpResult.error("参数为空！");
        }

        try {
            SpcyQyWjjl wjjl = spcyQyInfoService.uploadCommonParts(request.getParts(), id);

            return HttpResultVo.HttpResultSave(wjjl, "上传成功");
        }catch (Exception e){
            return HttpResult.error("上传失败！");
        }
    }

    @Log(title = "获取企业文件-文件记录-通过不同文件类型")
    @ApiOperation(value = "获取企业文件-文件记录-通过不同文件类型")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "fqyid",value = "企业id"),
            @ApiImplicitParam(name = "fwjlx1",value = "文件类型：质量管理体系文件 | 抽检不合格信息文件 | 不良反应信息文件 | 检验记录|信用评级")
    })
    @GetMapping(value = "queryWjljByType")
    public HttpResult<?> queryWjljByType(@RequestParam("fqyid") String fqyid,
                                         @RequestParam("fwjlx1")String fwjlx1,
                                         @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
                                         @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize){
        return spcyQyInfoService.queryWjljByType(fqyid, fwjlx1,pageNo,pageSize);
    }


//    @Log(title = "获取相关企业文件记录")
//    @ApiOperation(value = "获取相关企业文件记录")
//    @GetMapping(value = "queryQyInfoWjjl")
    public HttpResult<?> queryQyInfoWjjl(@RequestParam("id") String id){
        List<Map> mapList = spcyQyInfoService.queryWjljByWjml(id, null);
        return HttpResult.ok(mapList);
    }

    @Log(title = "获取企业的所有附件")
    @ApiOperation(value = "获取企业的所有附件")
    @GetMapping(value = "queryQyInfoAllFj")
    public HttpResult queryQyInfoAllFj(@RequestParam(value = "fqyid",defaultValue = "")String fqyid){
        if (StringUtils.isBlank(fqyid)){
            throw new BusinessException("企业参数丢失！");
        }
        return spcyQyInfoService.queryQyInfoAllFj(fqyid);
    }

}
